package util;

import java.util.concurrent.ConcurrentHashMap;

public class MxConcurrentHashMap<K, V> extends ConcurrentHashMap<K, V> {
    private final MxConcurrentHashMap<K, V> instance = new MxConcurrentHashMap<>();

    private MxConcurrentHashMap<K, V> getInstance() {
        if (!instance.isEmpty()) {
            instance.clear();
        }
        return instance;
    }

    public V safeGet(K k) {
        if (this.containsKey(k)) {
            return get(k);
        } else {
            return null;
        }
    }

    public static void main(String[] args) {
        MxConcurrentHashMap map = new MxConcurrentHashMap();
        map.safeGet(1);
    }
}
